<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="/grsun" prefix="grsun"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<meta name="description" content="Mailbox with some customizations as described in docs" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<%@ include file="/include/main_include.jsp"%>
<%@ include file="/include/form_include.jsp"%>
 
</head>
<body>
	<div class="modal-body" style="max-height: 716px;">
		<div id="divform" class="row mx-dialog-c bs_dialog open"> 
		   <form id="dataForm" class="form-horizontal" method="post"> 
		   <input type="hidden" id="diningStyleId" name="diningStyleId" value="${pd.diningStyleId}"/>   
			<div class="form-group col-lg-6 col-sm-6 col-xs-6">
		        <label class="control-label mx-group-title">路径</label>
		        <div class="mx-group-control" style="height:33px;">
					<input id="url" name="url" type="text" class="width-100 mx-input-group" style="height:33px;" value="${pd.url}">
		        </div>
		    </div>
			<div class="form-group col-lg-6 col-sm-6 col-xs-6">
		        <label class="control-label mx-group-title">排序</label>
		        <div class="mx-group-control" style="height:33px;">
					<input id="sorts" name="sorts" type="number" class="width-100 mx-input-group" style="height:33px;" value="${pd.sorts}">
		        </div>
		    </div>
			<div class="form-group col-lg-6 col-sm-6 col-xs-6">
		        <label class="control-label mx-group-title">描述</label>
		        <div class="mx-group-control" style="height:33px;">
					<input id="note" name="note" type="text" class="width-100 mx-input-group" style="height:33px;" value="${pd.note}">
		        </div>
		    </div>
			<div class="form-group col-lg-6 col-sm-6 col-xs-6">
		        <label class="control-label mx-group-title">名称</label>
		        <div class="mx-group-control" style="height:33px;">
					<input id="name" name="name" type="text" class="width-100 mx-input-group" style="height:33px;" value="${pd.name}">
		        </div>
		    </div>
			<div class="form-group col-lg-6 col-sm-6 col-xs-6">
		        <label class="control-label mx-group-title">二维码x坐标</label>
		        <div class="mx-group-control" style="height:33px;">
					<input id="codeX" name="codeX" type="text" class="width-100 mx-input-group" style="height:33px;" value="${pd.codeX}">
		        </div>
		    </div>
			<div class="form-group col-lg-6 col-sm-6 col-xs-6">
		        <label class="control-label mx-group-title">二维码y坐标</label>
		        <div class="mx-group-control" style="height:33px;">
					<input id="codeY" name="codeY" type="text" class="width-100 mx-input-group" style="height:33px;" value="${pd.codeY}">
		        </div>
		    </div>
			<div class="form-group col-lg-6 col-sm-6 col-xs-6">
		        <label class="control-label mx-group-title">二维码宽度</label>
		        <div class="mx-group-control" style="height:33px;">
					<input id="width" name="width" type="text" class="width-100 mx-input-group" style="height:33px;" value="${pd.width}">
		        </div>
		    </div>
			<div class="form-group col-lg-6 col-sm-6 col-xs-6">
		        <label class="control-label mx-group-title">二维码高度</label>
		        <div class="mx-group-control" style="height:33px;">
					<input id="height" name="height" type="text" class="width-100 mx-input-group" style="height:33px;" value="${pd.height}">
		        </div>
		    </div>
			 
		 
			<div class="form-group col-lg-6 col-sm-6 col-xs-6">
		        <label class="control-label mx-group-title">桌名X</label>
		        <div class="mx-group-control" style="height:33px;">
					<input id="diningNameX" name="diningNameX" type="text" class="width-100 mx-input-group" style="height:33px;" value="${pd.diningNameX}">
		        </div>
		    </div>
			<div class="form-group col-lg-6 col-sm-6 col-xs-6">
		        <label class="control-label mx-group-title">桌名Y坐标</label>
		        <div class="mx-group-control" style="height:33px;">
					<input id="diningNameY" name="diningNameY" type="text" class="width-100 mx-input-group" style="height:33px;" value="${pd.diningNameY}">
		        </div>
		    </div>
			<div class="form-group col-lg-6 col-sm-6 col-xs-6">
		        <label class="control-label mx-group-title">商家名距离二维码高度</label>
		        <div class="mx-group-control" style="height:33px;">
					<input id="heightYy" name="heightYy" type="text" class="width-100 mx-input-group" style="height:33px;" value="${pd.heightYy}">
		        </div>
		    </div>
		  </form>                  
		</div>
	</div>
	<script type="text/javascript">
	$(function() {
		$('#dataForm').validate({
			submitHandler : function(form) {
				var index = parent.layer.getFrameIndex(window.name);
				$.uitools.showLoading();//打开处理中遮罩层
				$.ajax({
					cache : true,
					type : "POST",
					url : rootpath + '/hhDiningStyle/save.do',
					data : $('#dataForm').serialize(),
					error : function(request) {
						$.uitools.hideLoading();//关闭处理中遮罩层
						layer.msg('系统异常！', {
							icon : 2,
							time : 1000
						}, function() {
							parent.layer.close(index);
						})
					},
					success : function(data) {
						$.uitools.hideLoading();//关闭处理中遮罩层
						if (data.code==0) {
							layer.msg('提交成功！', {
								icon : 1,
								time : 1000
							}, function() {
								parent.layer.close(index);
								//刷新列表
								parent.dataTable.datagrid('reload');
							})
						} else {
							layer.msg('提交异常！', {
								icon : 2,
								time : 1000
							}, function() {
								parent.layer.close(index);
							})
						}
					}
				});
			},
			rules : {
				diningStyleId : { required : true },
				url : { required : true },
				sorts : { required : true ,number : true},
				note : { required : true },
				name : { required : true },
				type : { required : true ,number : true},
				codeX : { required : true },
				codeY : { required : true },
				width : { required : true },
				height : { required : true },
				busNameX : { required : true },
				busNameY : { required : true },
				busNameColor : { required : true },
				busNameFont : { required : true },
				busNameBold : { required : true },
				busNameSize : { required : true },
				diningNameX : { required : true },
				diningNameY : { required : true },
				diningNameColor : { required : true },
				diningNameFont : { required : true },
				diningNameBold : { required : true },
				diningNameSize : { required : true },
				codeXx : { required : true },
				codeYy : { required : true },
				widthXx : { required : true },
				heightYy : { required : true }
			},
			messages : {
				diningStyleId : { required : '请输入' },
				url : { required : '请输入路径' },
				sorts : { required : '请输入排序' },
				note : { required : '请输入描述' },
				name : { required : '请输入名称' },
				type : { required : '请输入类型,几个二维码' },
				codeX : { required : '请输入二维码x坐标' },
				codeY : { required : '请输入二维码y坐标' },
				width : { required : '请输入二维码宽度' },
				height : { required : '请输入二维码高度' },
				busNameX : { required : '请输入商家名称x坐标' },
				busNameY : { required : '请输入商家名称y坐标' },
				busNameColor : { required : '请输入字体颜色' },
				busNameFont : { required : '请输入字体' },
				busNameBold : { required : '请输入加粗等' },
				busNameSize : { required : '请输入字号' },
				diningNameX : { required : '请输入桌名X' },
				diningNameY : { required : '请输入桌名Y坐标' },
				diningNameColor : { required : '请输入桌名颜色' },
				diningNameFont : { required : '请输入桌名字体' },
				diningNameBold : { required : '请输入桌名粗体等' },
				diningNameSize : { required : '请输入桌名字号大小' },
				codeXx : { required : '请输入' },
				codeYy : { required : '请输入' },
				widthXx : { required : '请输入' },
				heightYy : { required : '请输入' }
			},
			// 失去焦点时不执行验证
			onfocusout : false,
			// 错误提示，错误对象
			errorPlacement : function(error, element) {
				// 1.错误信息，2提示位置，3同时提示多个错误
				layer.tips(error[0].innerText, element, {
					// 错误信息可以同时提示多个，...
					tipsMore : true,
					tips : [ 3, '#D16E6C' ]
				});
			}
		});
	});
	</script>
</body>
</html>
